<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*,AdminController.AdminExe.AdminExeBean"%>
<jsp:useBean id="user" class="AdminController.AdminExe.AdminExeBean" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/Main/Css/Admin.css" />
<link rel="STYLESHEET" type="text/css" href="/KOMORIUTA/page/page.css">
<script src="/KOMORIUTA/Manage/jquery.js" type="text/javascript"></script>
<script src="/KOMORIUTA/Massage/Ms_Script.js" type="text/javascript"></script>
<script src="/KOMORIUTA/Manage/manage.js" type="text/javascript"></script>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%
AdminExeBean list[] = (AdminExeBean[])request.getAttribute("list");
AdminExeBean Rlist[] = (AdminExeBean[])request.getAttribute("Rlist");
ArrayList second = (ArrayList)request.getAttribute("second");
Map first = (HashMap)request.getAttribute("first");
int i = 0;
int mappingcount = 0;

if((Integer)request.getAttribute("mappingcount") != null){
	mappingcount = (Integer)request.getAttribute("mappingcount");
}
%>
</head>
<body>

	<%if( first == null && second == null){%>
	
	<table width="700px" border="0" align="center" cellpadding="4"
	cellspacing="2">
		<tr>
		<!-- 왼쪽 육아신청자 리스트 시작 -->
		<td width="35%" valign="top" align="center">育児申請者<hr>
		<%if(list.length==0){ %>
		  受付されません!
		<%}else if(list != null){ %>
		<form id="people" method="post" action="/KOMORIUTA/AdminExe.do?action_code=FinalAcept&num=1"/>
			<input type="hidden" id="currentPage" name="currentPage" />
			<table width="100%" border="1" cellspacing="2" cellpadding="4">
				<% for( i = 0 ; i < list.length ; i++){%>
				<tr>
					<td width="25%" align="center" valign="top"><%=list[i].getID() %></td>
					<td width="75%"><a class="black"
						href="javascript:finalcheck('<%=list[i].getMem_Id() %>');"><%=list[i].getMem_Nick() %></a></td>
				</tr>
				<%} %>
			</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr align="center">
				<td><%=request.getAttribute("paging") %></td>
			</tr>
		</table>
	 </form>
	<%} %>
		
		 <!-- 왼쪽 신청승낙대기자 리스트 -->
		<br/><br/><br/>
	   	承認の待機者<hr>
	   	<%if(Rlist.length==0){ %>
	   		まだ繋がりがありません
	   	<%}else if(Rlist != null){ %>
	   	<form id="mapworld" method="post" action="/KOMORIUTA/ApplicationsOld.do?action_code=mapfinal">
	   		<table width="100%" border="1" cellspacing="2" cellpadding="4">
	    		<% for( i = 0 ; i < Rlist.length ; i++){ %>
	    		<tr>
					<td width="25%" align="center" valign="top"><%=Rlist[i].getRmem_Id() %></td>
					<td width="75%"><a class="black"
						href="javascript:finalmapping('<%=Rlist[i].getRmem_Id() %>');"><%=Rlist[i].getRmem_Nick()%></a><br/>
						<%if(Rlist[i].getMap_Check() != 1){ %>
						受け入れる中...<a class="black" href="javascript:success('<%=Rlist[i].getRmem_Nick() %>');">確認</a>&nbsp;&nbsp;&nbsp;<a class="black" href="javascript:disable('<%=Rlist[i].getRmem_Nick() %>');">取り消す</a><br/>
						<%} %>
						<%if(Rlist[i].getMap_Check() == 1){ %>
						<a href="javascript:finalacept('<%=Rlist[i].getRmem_Id() %>');" class="black">契約進行中..</a>
						<div id="mapfinal">
					<table width="100%" border="1" align="center">
				  	<tr>
					 	
                    <td> <div align="center">
                        
                    	   メーモ<br/>
                        <textarea id="textarea" name="textarea" cols="5" rows="5"></textarea>
                        <br/>
                        <a class ="black" href="javascript:offline('<%=Rlist[i].getRmem_Id() %>');">承認</a>
                       	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a class ="black" href="javascript:offlinefail('<%=Rlist[i].getRmem_Id() %>');">取り消す</a>
                      	  
                      	 <!-- 
                        <a class ="black" href="javascript:offline('<%=Rlist[i].getRmem_Id() %>');">삭제</a>
                       	
                        	 삭제<input class="fcheck" type="radio" name="fcheck" value="1"/>
							승인	<input class="fcheck" type="radio" name="fcheck" value="2"/>
							<a href="javascript:megacheck();" class="black">확인</a> 
							-->
                      </div></td>
					</tr>
					
				  </table>
			   
			   </div> 
						
						<%} %>
					</td>
				</tr>
			
			<%} %>
			 	 </table>
			</form>
	    	<%} %>
	    <!-- 왼쪽 신청승낙대기자 리스트끝 -->
	   
	   
	   
	    <!-- 왼쪽 서비스되고 있는 목록 리스트 -->
	    <br/><br/><br/>
	   	サービスのご利用リスト<hr>
	    
	    <table width="100%" border="1" cellspacing="2" cellpadding="4">
	      <tr>
	      	<% if(mappingcount == 0){ %>
	      		<td><div align="center">まだご利用者がいません！</div></td>
	        <%}else{ %>
		        <td><div align="center">現在 [<%=mappingcount %>]件のご方がいます。<br/>
		        <a href="javascript:mappingList()" class="black">リストの確認</a></div></td>
	        <%} %>
	      </tr>
	    </table>
	    
	    </td>
	  	<!-- 왼쪽 서비스되고 있는 목록 리스트 끝-->
	   
	   
	   <!-- 왼쪽 육아신청자 리스트 끝 -->
	    
	   
	   
	  <!-- 맵핑 결과 시작 오른쪽 -->
	    <td width="65%" valign="top" align="center">
		<%if(list == null){ %>
			
			受け付けられたご方がいません!!
	
		<%}else if(list != null){ %>
			
			申請者の情報及び照会(IDをクリックして下さい!)
			<hr>
	
			<div class="final"></div>
			<!-- 맵핑 결과 끝 오른쪽 --> 
		<%} %>				
		</td></tr></table>
		
		<!--맵핑버튼 눌렀을떄 나오는 화면!!  -->
		<%}else {	%>
		<table width="700px" border="0" align="center" cellpadding="4"cellspacing="2">
		<!-- 1지망 리스트 출력시작 -->
		<tr>
			<td align="center" style="font-size:20px;font-weight:bold;color:#c11455;">第一希望者
			<hr>
		</tr>
			<%					
			i=0;
			if(first != null && first.size()>0){
				Iterator Fiter = first.keySet().iterator();

				 while(Fiter.hasNext())
				 {
				  i++;
				  int key = (Integer)Fiter.next();
				  String value = (String)first.get(key);
				  System.out.println("현재값:"+value);
				  System.out.println("현재 숫자아이디:"+key);
			%>
			<tr>
			  <td>
			  	<form name="firstgo" method="post" action="/KOMORIUTA/AdminExe.do?">
			  	<input type="hidden" name="Mem_Id" value="<%=key %>"/>
			  	<input type="hidden" name="first_Id" value="<%=request.getParameter("memid") %>"/>
			  	<input type="hidden" name="action_code" value="mapping"/>
				
				<div style="position:relative;left:150px;width:400px;height:50px;border:2px solid #5060c0;border-bottom-style:dashed;border-top-style:dashed;border-right-style:none;border-left-style:none;color:#560689;">
				<table align="center" width="400" border="0" cellpadding="0" cellspacing="0">
					
					<tr height="50">
						<td width="50" align="center" valign="middle" style="font-size:20px;font-weight:bold;color:#c11455;">1</td>
						<td width="200" valign="middle" align="center" style="font-size:20px;font-weight:bold;color:#c11455;">
						<%=value%>
						</td>
						<td align="center">
						<input name="Fmessage" class="mm" type="submit" value=""></td>
					</tr>
				</table>
			</div>
				<div style="position:relative;width:650px;height:20px;"></div>
			  </form>
			</td>
		</tr>
		<%}
		}else{%>
		<tr>
			<td><div align="center">条件に当てはまる方がいません！</div></td>
		</tr>
	<!-- 1지망 리스트 출력끝 -->
	 <%} %>		
	 
	 <!-- 2지망 리스트 출력시작 -->	
	 	<tr>
		<td align="center" style="font-size:20px;font-weight:bold;color:#c11455;">第二希望者
		<hr>
	<%
	i = 0;
	if(second!=null && second.size()>0){ 
		Iterator iter = second.iterator();
	%>
				
				<%
			
				while ( iter.hasNext() ) {
					i++;
					user = (AdminExeBean)iter.next();
					System.out.println("현재이름:"+user.getMem_Nick());
					System.out.println("현재숫자아이디:"+user.getMem_Id());
				%>
			
				<form name="secondgo" method="post" action="/KOMORIUTA/AdminExe.do?">	
				<input type="hidden" name="Mem_Id" value="<%=user.getMem_Id() %>"/>
				<input type="hidden" name="first_Id" value="<%=request.getParameter("memid") %>"/>
				<input type="hidden" name="action_code" value="mapping"/>
				
			
				<table  align="center" width="400" cellpadding="0" cellspacing="0">
			<tr height="50" align="center" >
				<td width="50" align="center" valign="middle" style="border-top: 2px solid #5060c0; border-bottom: 2px solid #5060c0; border-bottom-style:dashed;border-top-style:dashed;">2</td>
				<td width="200" valign="middle" align="center" style="border-top: 2px solid #5060c0; border-bottom: 2px solid #5060c0; border-bottom-style:dashed;border-top-style:dashed;">
				<%=user.getMem_Nick() %>
				</td>
				<td style="border-top:2px solid #5060c0; border-bottom: 2px solid #5060c0; border-bottom-style:dashed;border-top-style:dashed;"><input name="Fmessage" class="mm" type="submit" value=""></td>
			</tr>
			<tr><td colspan="3">&nbsp;</td></tr>
			<%} %>
			
		</table>
		<br/>	
	</form>
	
	<%}else{%>
	<tr>
		<td><div align="center">条件に当てはまる方がいません！</div></td>
	</tr>
	<%} %>
	
</table>

<%} %>

</body>
</html>